#!/bin/bash

# Path to the folder containing mp4 files here
files="output/*.mp4"

for f in $files
do
    duration=$(ffmpeg -i "$f" 2>&1 | grep "Duration"| cut -d ' ' -f 4 | sed s/,// | awk '{ split($1, A, ":"); print 3600*A[1] + 60*A[2] + A[3] }')
    duration=${duration/.*}
    if [ "$duration" -lt 280 ];
    then
        echo $f
    fi
done
